<!DOCTYPE html>
<html lang="en">
<head>
    <title>公司进大区拜访</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=4a6c1b54">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <script src="https://file.ggxqce.com/web/vue.min.js"></script>
    <style>
        [v-cloak] {
            display: none;
        }

        .reginTd {
            max-width: 105px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            position: relative;
        }

        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            font-size: 12px;
        }

        body {
            margin: 1px;
            background: #f8f8f8;
        }

        table {
            border-spacing: 1px;
            border-collapse: collapse;
            display: table;
        }

        table.text-center, table.text-center td, table.text-center th {
            text-align: center;
            font-size: 12px;
        }

        .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
            border: 1px solid #cbcbcd;
            font-weight: normal;
            height: 24px;
        }

        .table th {
            background: yellow;
        }

        .table-bordered {
            border: 1px solid #cbcbcd;
        }

        .table {
            width: 100%;
            max-width: 100%;
        }

        .hidden {
            display: none;
        }

        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 24px;
            line-height: 24px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .mScrollBox {
            float: left;
            position: relative;
            overflow: hidden;
        }

        .toggleDiv div {
            width: 50%;
            float: left;
            text-align: center;
        }

        .toggleDiv div.active {
            border-bottom: 2px solid #2289ee;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .boxs {
            width: auto;
            display: flex;
            justify-content: center;
            border-bottom: 1px solid #f8f8f8;
            line-height: 24px;
            margin-bottom: 5px;
            margin-top: 5px;
        }

        .lefts {
            text-align: center;
            color: #228bee;
            /*border-bottom: 2px solid #228bee;*/
            margin-left: 8px;
            margin-right: 8px;
        }

        .rights {
            text-align: center;
            color: #666666;
            /*border-bottom: 2px solid #f8f8f8;*/
            margin-left: 8px;
            margin-right: 8px;
        }
    </style>
</head>
<body>
<section id="app" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <div id="daQuVisitCompany">
        <div class="boxs" v-if="daQuVisitCompany.time==today" style="margin-top: 15px">
            <div :class="a==1?'lefts':'rights'" @click="a=1">
                实时数据
            </div>
            <div style="width: 1px;height: 11px;background: #999999; margin-top: 6px;"></div>
            <div :class="a==1?'rights':'lefts'" @click="a=0">
                首次面访
            </div>
        </div>

        <div style="width: 100%;margin:0 auto;" class="mScrollBox">
            <table class="table text-center table-width table-bordered">
                <thead>
                <tr>
                    <!--今日-->
                    <template v-if="daQuVisitCompany.time==today">
                        <!--今日首次-->
                        <template v-if="a==0">
                            <th style="width: 42px">大区<br/>经理</th>
                            <th style="width: 55px">考勤<br/>签到</th>
                            <th style="width: 42px">首面<br/>陪同</th>
                            <th style="width: 55px">首面<br/>时间</th>
                            <th>时间间隔</th>
                            <!--<th>时间间隔<br/></th>-->
                            <!--<th>距离<br/>(km)</th>-->
                            <!--<th>时速<br/>(km/h)</th>-->
                            <th>大区</th>
                            <!--<th>备注</th>-->
                        </template>
                        <!--实时数据-->
                        <template v-else>
                            <th>大区<br/>经理</th>
                            <th>面访<br/>计划</th>
                            <th>面访<br/>完成</th>
                            <th style="width: 75px">考勤签到</th>
                            <th style="width: 75px">考勤签退</th>
                            <th>大区</th>
                        </template>
                    </template>
                    <!--昨日-->
                    <template v-else-if="daQuVisitCompany.time==yesterday">
                        <th>大区<br/>经理</th>
                        <th>面访<br/>计划</th>
                        <th>面访<br/>完成</th>
                        <th style="width: 75px">考勤签到</th>
                        <th style="width: 75px">考勤签退</th>
                        <th>大区</th>
                    </template>
                    <!--本周本月等-->
                    <template v-else>
                        <th>大区经理</th>
                        <th>面访计划</th>
                        <th>面访完成</th>
                        <th>出勤天数</th>
                        <th>日均完成</th>
                        <th>大区</th>
                    </template>
                </tr>
                </thead>
                <tbody v-cloak>
                <tr v-for="(item,i) in daQuVisitCompany.faceList">
                    <!--今日-->
                    <template v-if="daQuVisitCompany.time==today">
                        <!--今日首次-->
                        <template v-if="a==0">
                            <td>{{item.name}}</td>
                            <td class="lineOne">
                                <template v-if="item.signState == 1">
                                    <span style="text-align: center;">请假</span>
                                </template>
                                <template v-else>
                                    <span style="text-align: center;">{{item.signInTime.split(' ')[1]}}</span>
                                </template>
                            </td>
                            <td>{{item.firstFaceName}}</td>
                            <td>{{item.firstFaceSignInTime.split(' ')[1]}}</td>
                            <td class="lineOne">
                                <template
                                        v-if="item.signInTimeDiff && item.signInTimeDiff.length>2">
                                    <template
                                            v-if="item.firstFaceName=='无' || item.firstFaceName==''">
                                        <span style="text-align: center;">{{addZeroHour(quMiao(item.signInTimeDiff))}}<br/>自己拜访</span>
                                    </template>
                                    <template v-else>
                                        <span style="text-align: center;">{{addZeroHour(quMiao(item.signInTimeDiff))}}<br/>签到相距:{{dJq(item.signInDistance)}}公里<br/>时速:{{disJq(item.signInSpeed)}}公里/小时</span>
                                    </template>
                                </template>
                                <template v-else>
                                    <!--<span style="text-align: center;">请假</span>-->
                                </template>
                                </span>
                            </td>
                            <!--<td><span v-if="item.signOutTimeDiff != ''">{{dJq(item.signOutDistance)}}</span>-->
                            <!--</td>-->
                            <!--<td>{{disJq(item.signOutSpeed)}}</td>-->
                            <td><span>{{item.departName}}</span></td>
                            <!--<td class="lineOne" style="border-left: 1px solid #cbcbcd;"><span-->
                            <!--style="text-align: left;"></span></td>-->
                        </template>
                        <!--实时数据-->
                        <template v-else>
                            <td>{{item.name}}</td>
                            <td v-if="isCheckRegionName(item)&&item.planCount!='-'" @click="openPlan(item)" style="color:#169BD5;cursor: pointer">
                                {{item.planCount}}
                            </td>
                            <td v-else>
                                {{item.planCount}}
                            </td>
                            <td v-if="isCheckRegionName(item)&&item.finishCount!='-'" @click="openInterview(item,'1')"
                                style="color:#169BD5;cursor: pointer"> {{item.finishCount}}
                            </td>
                            <td v-else>
                                {{item.finishCount}}
                            </td>
                            <td class="lineOne">
                                <!--签到 signState=0   请假 signState=1 -->
                                <template v-if="item.signState == 1">
                                    <span style="text-align: center;">请假</span>
                                </template>
                                <template v-else>
                                    <template v-if="item.signInTime && item.signInTime.length>2">
                                        <!--如果没有首次面访 显示未首次面访-->
                                        <template
                                                v-if="item.firstFaceSignInTime && item.firstFaceSignInTime.length>2">
                                            <span style="text-align: center;">{{item.signInTime.split(' ')[1]}}<br/>首面时间:{{item.firstFaceSignInTime.split(' ')[1]}}<br/>首面陪同:{{item.firstFaceName}}<br/>时间间隔:{{addZeroHour(quMiao(item.signInTimeDiff))}}<br/>距离间隔:{{dJq(item.signInDistance)}}公里<br/>时速:{{disJq(item.signInSpeed)}}公里/小时</span>
                                        </template>
                                        <template v-else>
                                            <span style="text-align: center;">{{item.signInTime.split(' ')[1]}}<br/>未首次面访</span>
                                        </template>
                                    </template>
                                    <template v-else>
                                        <span style="text-align: center;">请假</span>
                                    </template>
                                </template>
                            </td>
                            <!--style="border-left: 2px solid rgb(22, 155, 213);"-->
                            <td class="lineOne">
                                <template v-if="item.signState == 1">
                                    <span style="text-align: center;"></span>
                                </template>
                                <template v-else>
                                    <template v-if="item.signOutTime && item.signOutTime.length>2">
                                        <span style="text-align: center;"> {{item.signOutTime.split(' ')[1]}}<br/>末面时间:{{item.endFaceSignOutTime.split(' ')[1]}}<br/>末面陪同:{{item.endFaceName}}<br/>时间间隔:{{addZeroHour(quMiao(item.signOutTimeDiff))}}<br/>距离间隔:{{dJq(item.signOutDistance)}}公里<br/>时速:{{disJq(item.signOutSpeed)}}公里/小时</span>
                                    </template>
                                    <template v-else>
                                        <span style="text-align: center;"></span>
                                    </template>
                                </template>
                            </td>
                            <td><span>{{item.departName}}</span></td>
                        </template>
                    </template>
                    <!--昨日-->
                    <template v-else-if="daQuVisitCompany.time==yesterday">
                        <td>{{item.name}}</td>
                        <td @click="openPlan(item)" style="color:#169BD5;cursor: pointer">
                            {{item.planCount}}
                        </td>
                        <td @click="openInterview(item,'1')" style="color:#169BD5;cursor: pointer">
                            {{item.finishCount}}
                        </td>
                        <td class="lineOne">
                            <template v-if="item.signState == 1">
                                <span style="text-align: center;">请假</span>
                            </template>
                            <template v-else>
                                <template v-if="item.signInTime && item.signInTime.length>2">
                                    <!--如果没有首次面访 显示未首次面访-->
                                    <template
                                            v-if="item.firstFaceSignInTime && item.firstFaceSignInTime.length>2">
                                        <span style="text-align: center;">{{item.signInTime.split(' ')[1]}}<br/>首面时间:{{item.firstFaceSignInTime.split(' ')[1]}}<br/>首面陪同:{{item.firstFaceName}}<br/>时间间隔:{{addZeroHour(quMiao(item.signInTimeDiff))}}<br/>距离间隔:{{dJq(item.signInDistance)}}公里<br/>时速:{{disJq(item.signInSpeed)}}公里/小时</span>
                                    </template>
                                    <template v-else>
                                        <span style="text-align: center;">{{item.signInTime.split(' ')[1]}}<br/>未首次面访</span>
                                    </template>
                                </template>
                                <template v-else>
                                    <span style="text-align: center;">请假</span>
                                </template>
                            </template>
                        </td>
                        <td class="lineOne">
                            <template v-if="item.signState == 1">
                                <span style="text-align: center;"></span>
                            </template>
                            <template v-else>
                                <template v-if="item.signOutTime && item.signOutTime.length>2">
                                    <!--如果没有首次面访 显示未首次面访-->
                                    <template
                                            v-if="item.endFaceSignInTime && item.endFaceSignInTime.length>2">
                                        <span style="text-align: center;">{{item.signOutTime.split(' ')[1]}}<br/>末面时间:{{item.endFaceSignOutTime.split(' ')[1]}}<br/>末面陪同:{{item.endFaceName}}<br/>时间间隔:{{addZeroHour(quMiao(item.signOutTimeDiff))}}<br/>距离间隔:{{dJq(item.signOutDistance)}}公里<br/>时速:{{disJq(item.signOutSpeed)}}公里/小时</span>
                                    </template>
                                    <template v-else>
                                        <span style="text-align: center;">{{item.signInTime.split(' ')[1]}}<br/>无末次面访</span>
                                    </template>

                                </template>
                                <template v-else>
                                    <span style="text-align: center;"></span>
                                </template>
                            </template>
                        </td>
                        <td><span>{{item.departName}}</span></td>
                    </template>
                    <!--本周本月等-->
                    <template v-else>
                        <td>{{item.name}}</td>
                        <td @click="openPlan(item)" style="color:#169BD5;cursor: pointer">
                            {{item.planCount}}
                        </td>
                        <td @click="openInterview(item,'1')" style="color:#169BD5;cursor: pointer">
                            {{item.finishCount}}
                        </td>
                        <td><span style="text-align: center;">{{item.signInNum}}</span></td>
                        <td><span style="text-align: center;">{{item.finishCount&&item.finishCount!='-'&&item.signInNum&&item.signInNum!='-'?(item.finishCount/item.signInNum).toFixed(1):'-'}}</span>
                        </td>
                        <td><span>{{item.departName}}</span></td>
                    </template>

                    <!--大区经理-->
                    <!--<td>{{item.name}}</td>-->
                    <!--计划-->
                    <!--<template v-if="!(daQuVisitCompany.time==today && a==0)">-->
                    <!--<td @click="openPlan(item)" style="color:#169BD5;cursor: pointer" >{{item.planCount}}</td>-->
                    <!--</template>-->
                    <!--<template v-if="!(daQuVisitCompany.time==today && a==0)">-->
                    <!--<td @click="openPlan(item)" style="color:#169BD5;cursor: pointer">{{item.planCount}}</td>-->
                    <!--</template>-->
                    <!--完成-->
                    <!--<template v-if="!(daQuVisitCompany.time==today && a==0)">-->
                    <!--<td @click="openInterview(item,'1')" style="color:#169BD5;cursor: pointer">     {{item.finishCount}}</td>-->
                    <!--</template>-->
                    <!--考勤签到时间-->
                    <!--<td v-if="daQuVisitCompany.time.length==10" class="lineOne"-->
                    <!--style="border-left: 1px solid rgb(203, 203, 205);">-->
                    <!--<span style="text-align: center;">{{item.signInTime?item.signInTime.split(' ')[1]:'请假'}}</span>-->
                    <!--</td>-->
                    <!--?item.signInTime.split(' ')[1]:'请假'-->
                    <!--首次陪同人员-->
                    <!--<td v-if="daQuVisitCompany.time.length==10">{{item.firstFaceName}}</td>-->
                    <!--首次面访签到时间-->
                    <!--<td v-if="daQuVisitCompany.time.length==10">{{item.firstFaceSignInTime.split(' ')[1]}}</td>-->
                    <!--签到与首次面访 时间差-->
                    <!--<td v-if="daQuVisitCompany.time.length==10">-->
                    <!--<span style="text-align: center;">{{addZeroHour(quMiao(item.signInTimeDiff))}}</span>-->
                    <!--</td>-->
                    <!--签到与首次面访 距离差-->
                    <!--<td v-if="daQuVisitCompany.time.length==10">-->
                    <!--<span style="text-align: center;" v-if="item.signInTimeDiff != ''">{{dJq(item.signInDistance)}}</span>-->
                    <!--</td>-->
                    <!--签到与首次面访 平均时速-->
                    <!--<td v-if="daQuVisitCompany.time.length==10">-->
                    <!--<span style="text-align: center;">{{disJq(item.signInSpeed)}}</span>-->
                    <!--</td>-->
                    <!--出勤天数-->
                    <!--<td v-if="daQuVisitCompany.time.length!=10"><span style="text-align: center;">{{item.signInNum}}</span></td>-->
                    <!--日均完成-->
                    <!--<td v-if="daQuVisitCompany.time.length!=10"><span style="text-align: center;">{{item.averageComplete}}</span>-->
                    <!--</td>-->
                    <!--<template-->
                    <!--v-if="(daQuVisitCompany.time==today && a==1)||daQuVisitCompany.time==yesterday">-->
                    <!--考勤签退时间-->
                    <!--<td style="border-left: 2px solid rgb(22, 155, 213);">-->
                    <!--{{item.signOutTime.split(' ')[1]}}-->
                    <!--</td>-->
                    <!--末次面访签退时间-->
                    <!--<td>{{item.endFaceSignOutTime.split(' ')[1]}}</td>-->
                    <!--末次面访陪同人员-->
                    <!--<td>{{item.endFaceName}}</td>-->
                    <!--签退与末次面访 时间差-->
                    <!--<td>-->
                    <!--<span>-->
                    <!--{{addZeroHour(quMiao(item.signOutTimeDiff))}}-->
                    <!--</span>-->
                    <!--</td>-->
                    <!--签退与末次面访 距离差-->
                    <!--<td >-->
                    <!--<span v-if="item.signOutTimeDiff != ''">{{dJq(item.signOutDistance)}}</span>-->
                    <!--</td>-->
                    <!--签退与末次面访 平均时速-->
                    <!--<td >{{disJq(item.signOutSpeed)}}</td>-->
                    <!--</template>-->
                    <!--大区-->
                    <!--<td><span>{{item.departName}}</span></td>-->
                    <!--问题描述-->
                    <!--<td v-if="daQuVisitCompany.time==today &&a==0" class="lineOne"-->
                    <!--style="border-left: 1px solid #cbcbcd;">-->
                    <!--<span style="text-align: left;"></span>-->
                    <!--</td>-->
                </tr>

                <!--合计行-->
                <tr>
                    <!--今日-->
                    <template v-if="daQuVisitCompany.time==today">
                        <!--今日首次-->
                        <template v-if="a==0">
                            <!--无合计行-->
                        </template>
                        <!--实时数据-->
                        <template v-else>
                            <td>合计</td>
                            <td>
                                {{daQuVisitCompany.allDate[1].planCount==0?'-':daQuVisitCompany.allDate[1].planCount}}
                            </td>
                            <td>
                                {{daQuVisitCompany.allDate[1].finishCount==0?'-':daQuVisitCompany.allDate[1].finishCount}}
                            </td>
                            <td>-</td>
                            <td>-</td>
                            <td>-</td>
                        </template>
                    </template>
                    <!--昨日-->
                    <template v-else-if="daQuVisitCompany.time==yesterday">
                        <td>合计</td>
                        <td>
                            {{daQuVisitCompany.allDate[1].planCount==0?'-':daQuVisitCompany.allDate[1].planCount}}
                        </td>
                        <td>
                            {{daQuVisitCompany.allDate[1].finishCount==0?'-':daQuVisitCompany.allDate[1].finishCount}}
                        </td>
                        <td>-</td>
                        <td>-</td>
                        <td>-</td>
                    </template>
                    <!--本周本月等-->
                    <template v-else>
                        <td>合计</td>
                        <td>
                            {{daQuVisitCompany.allDate[1].planCount==0?'-':daQuVisitCompany.allDate[1].planCount}}
                        </td>
                        <td>
                            {{daQuVisitCompany.allDate[1].finishCount==0?'-':daQuVisitCompany.allDate[1].finishCount}}
                        </td>
                        <td>-</td>
                        <td>-</td>
                        <td>-</td>
                    </template>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=602456c3"></script>
<script src="/dist/plugins/scroll/myScroll.js"></script>

<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).html();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + 80 + "px",
                        "left": $(this).offset().left - 6,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    $(function () {
        $("body").on("click", ".reginTd", function (e) {
            var text = $(this).text();
            if (text != "") {
                text = "<i></i>" + text;
                $(".div-td-content-more").html(text).css({
                    "width": $(this).outerWidth() + "px",
                    "left": $(this).offset().left,
                    "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                }).show();
                e.stopPropagation();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });

    });

</script>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            companyId: getUrlParamObj().companyId,
            userId: getUrlParamObj().userId,
            dateTime: getUrlParamObj().dateTime,
            yesterday: new Date(new Date() - 24 * 60 * 60 * 1000).Format("yyyy-MM-dd"),
            today: new Date().Format("yyyy-MM-dd"),
            thisMonth: new Date().Format("yyyy-MM"),
            thisWeek: new Date().Format("yyyy-MM-dd") + "-w",
            hour: new Date().getHours(),
            regionNames: [],//该人员拥有的区域列表名称
            reginIds: [],
            a: 1,
            daQuVisitCompany: {
                time: getUrlParamObj().dateTime,
                faceList: [],
                telList: [],
                allDate: [
                    {"planCount": "", "finishCount": "", "signInNum": "", "errorNum": ""},
                    {"planCount": "", "finishCount": ""}
                ],
            },
            userBox: {
                name: '',
                tel: '',
                roleName: '',
                entryDate: '',
                dayNumber: ''
            }
        },
        methods: {
            isFair: function (item) {
                var str = '';
                if (!this.distanceJq(item.signInDistance) && !this.timeJq(item.signInTimeDiff)) {
                    str = "距离、时间不合理"
                }
                else if (!this.distanceJq(item.signInDistance)) {
                    str = "距离不合理"
                }
                else if (!this.timeJq(item.signInTimeDiff)) {
                    str = "时间不合理"
                }
                return str
            },
            //距离合理->true 不合理->false
            distanceJq: function (d) {
                if (d) {
                    var str = d.replace("公里", "");
                    return Number(str) < 15
                }
            },
            //时间合理->true 不合理->false
            timeJq: function (t) {
                if (t) {
                    if (t.indexOf("小时") > 0) {
                        var hour = t.split("小时")[0];
                        if (Number(hour) > 0) {
                            return false;
                        }
                    } else {
                        if (t.indexOf("分") > 0) {
                            var min = t.split("分")[0];
                            if (Number(min) > 30) {
                                return false;
                            }
                        } else {
                            return true;
                        }
                    }
                }
                return true;
            },
            //距离间隔
            dJq: function (d) {
                if (d) {
                    var str = d.replace("公里", "");
                    console.log("距离间隔 = " + str)
                    if (str == '0') {
                        return '';
                    } else {
                        return Number(str).toFixed(2);
                    }
                }
            },
            //速度
            disJq: function (dis) {
                if (dis) {
                    var str = dis.replace("km/h", "");
                    return str;
                }
            },
            //去秒加0几分
            quMiao: function (m) {
                if (!m) return ""
                //1小时11分11秒
                var hour = "0"
                var min = "0"
                var sec = "0"

                if (m.indexOf("小时") > 0) {
                    //{1  , 11分11秒} 1小时55秒
                    hour = m.split("小时")[0]
                }
                if (m.indexOf("分") > 0) {
                    //{1小时11，11秒}
                    min = m.split("分")[0]
                    if (min.indexOf("小时") > 0) {
                        //{1,11}
                        min = min.split("小时")[1]
                    }
                    if (Number(min) < 10) {
                        min = "0" + min
                    }
                }
                if (min == "0" && m.indexOf("秒") > 0) {
                    //21秒
                    return hour + "小时01分"
                }
                return hour + "小时" + min + "分"
            },
            //添加0小时xx分
            addZeroHour: function (h) {
                if (!h) {
                    return ""
                }
                if (h.indexOf('小时') > 0) {
                    return h
                } else {
                    return "0小时" + h
                }
            },
            //获取合计
            getCount: function (arr, key) {
                var number = 0;
                for (var i = arr.length - 1; i >= 0; i--) {
                    number += (arr[i][key] && arr[i][key] != '-' ? Number(arr[i][key]) : 0)

                }
                return number;
            },
            lookPersonnelDepartList: function (item) {
                top.addTabs({
                    id: "look" + item.id,
                    title: item.managerName + "详情",
                    close: true,
                    url: '/personnel/entry.html?id=' + item.userId + '&pageType=look'
                });
            },
            getAll: function (arr, type) {
                if (type == "1") {
                    this.daQuVisitCompany.allDate[1].planCount = this.getCount(arr, "planCount");
                    this.daQuVisitCompany.allDate[1].finishCount = this.getCount(arr, "finishCount");
                    this.daQuVisitCompany.allDate[1].signInNum = this.getCount(arr, "signInNum");
                    this.daQuVisitCompany.allDate[1].errorNum = this.getCount(arr, "errorNum");
                    this.daQuVisitCompany.allDate[1].averageComplete = (this.daQuVisitCompany.allDate[1].finishCount / this.daQuVisitCompany.allDate[1].signInNum).toFixed(2);
                } else {
                    this.daQuVisitCompany.allDate[0].finishCount = this.getCount(arr, "finishCount");
                    this.daQuVisitCompany.allDate[0].signInNum = this.getCount(arr, "signInNum");
                    this.daQuVisitCompany.allDate[0].averageComplete = (this.daQuVisitCompany.allDate[0].finishCount / this.daQuVisitCompany.allDate[0].signInNum).toFixed(2);
                }
            },
            //获取拜访报表-区域经理
            get_daQuVisitCompany: function () {
                var that = this;

                var dialog = {
                    dialog: 'show'
                }
                prompt(JSON.stringify(dialog))

                var param = {
                    "companyId": that.companyId,
                    "userId": that.userId,
                    "dateTime": that.dateTime,
                    "visitType": "1"
                }
                $.ajax({
                    url: server.ip + urlConfig.report.visitCustomer.getBigRegionManagerVisitForDepart,
                    contentType: 'application/json;charset=utf-8',
                    type: "POST",
                    data: JSON.stringify(param),
                    success: function (r) {
                        var dialog = {
                            dialog: 'hidden'
                        }
                        prompt(JSON.stringify(dialog))

                        var res = JSON.parse(r);
                        var sendData = res.data.sendData
                        var data = trimRN2(sendData);
                        that.daQuVisitCompany.faceList = data;
                        that.getAll(that.daQuVisitCompany.faceList, "1");
                    },
                    error: function (e) {
                        var dialog = {
                            dialog: 'hidden'
                        }
                        prompt(JSON.stringify(dialog))

                        alert(e.responseText)
                    }
                })

            },
            openPlan: function (item) {
                var that = this;
                var obj = {
                    type: 'customerList',
                    url: '/reportForm/interview/daQuPlanApp.html?userId=' + item.userId + '&name=' + item.name + '&dateTime=' + this.daQuVisitCompany.time + "&visitType=1",
                    id: item.userId,
                    name: item.name + "-面访计划",
                    dateTime: that.daQuVisitCompany.time
                }
                prompt(JSON.stringify(obj))
            },
            openInterview: function (item, type) {
                var that = this;
                var obj = {
                    type: 'customerList',
                    url: '/reportForm/interview/daQuinterviewCustomerListApp.html?userId=' + item.userId + '&name=' + item.name + '&dateTime=' + this.daQuVisitCompany.time + "&visitType=1",
                    id: item.userId,
                    name: item.name + "-面访完成",
                    dateTime: that.daQuVisitCompany.time
                }
                prompt(JSON.stringify(obj))
            },
            isCheckRegionName: function (item) {
                var that = this;
                if (that.isHasregionNameOp(item.departName)) {
                    return true
                }
                else {
                    return false
                }
            },
            isHasregionNameOp: function (departName) {
                // console.log($.inArray(regionName, this.regionNames) > -1)
                return $.inArray(departName.replace('大区', ''), this.regionNames) > -1;
            },
            getRegionNameByUserId: function () {
                var that = this;
                var param = {
                    "userId": that.userId,
                }
                $.ajax({
                    url: server.ip + urlConfig.report.visitCustomer.getForDepartByUserIdForClick,
                    contentType: 'application/json;charset=utf-8',
                    type: "POST",
                    async:'true',
                    data: JSON.stringify(param),
                    success: function (r) {
                        var res = JSON.parse(r);
                        var ids = res.data.sendData
                        for (var i = 0; i < ids.length; i++) {
                            that.regionNames.push(ids[i].regionName);
                        }
                    },
                })
            },
        },
        mounted: function () {
            var that = this;
            that.getRegionNameByUserId();
            that.get_daQuVisitCompany();

        }

    });
</script>
</body>
</html>